home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / sendmail.8.8.4.tar.gz / sendmail.8.8.4.tar / sendmail-8.8.4 / smrsh / README < prev    next >
Text File  |  1995-11-11  |  5KB  |  145 lines

  1.  
  2.  
  3.  
  4. README  smrsh - sendmail restricted shell.
  5.  
  6.     @(#)README    8.2    11/11/95
  7.  
  8.  
  9. This README file is provided as a courtesy of the CERT Coordination Center,
  10. Software Engineering Institute, Carnegie Mellon University.  This file is 
  11. intended as a supplement to the CERT advisory CA-93:16.sendmail.vulnerability,
  12. and to the software, smrsh.c, written by Eric Allman.
  13.  
  14.  
  15.  
  16. The smrsh(8) program is intended as a replacement for /bin/sh in the
  17. program mailer definition of sendmail(8).  This README file describes
  18. the steps needed to compile and install smrsh.
  19.  
  20. smrsh is a restricted shell utility that provides the ability to
  21. specify, through a configuration, an explicit list of executable
  22. programs.  When used in conjunction with sendmail, smrsh effectively
  23. limits sendmail's scope of program execution to only those programs
  24. specified in smrsh's configuration.
  25.  
  26. smrsh has been written with portability in mind, and uses traditional 
  27. Unix library utilities.  As such, smrsh should compile on most
  28. Unix C compilers.
  29.  
  30.  
  31.  
  32. To compile smrsh.c, use the following command:
  33.  
  34. host.domain% cc -o smrsh smrsh.c
  35.  
  36. For machines that provide dynamic linking, it is advisable to compile
  37. smrsh without dynamic linking.  As an example with the Sun Microsystems
  38. compiler, you should compile with the -Bstatic option.
  39.  
  40. host.domain% cc -Bstatic -o smrsh smrsh.c
  41.  
  42.  
  43. Choose a directory that smrsh will reside in.  We will use the traditional 
  44. /usr/local/etc directory for the remainder of this document.
  45.  
  46. As root, install smrsh in /usr/local/etc directory, with mode 511.
  47.  
  48. host.domain# mv smrsh /usr/local/etc
  49. host.domain# chmod 511 /usr/local/etc/smrsh
  50.  
  51.  
  52.  
  53. Next, determine the list of commands that smrsh should allow sendmail
  54. to run.  This list of allowable commands can be determined by:
  55.  
  56.    1.  examining your /etc/aliases file, to indicate what commands 
  57.        are being used by the system. 
  58.  
  59.    2.  surveying your host's .forward files, to determine what 
  60.        commands users have specified.  
  61.  
  62. See the man page for aliases(5) if you are unfamiliar with the format of 
  63. these specifications. Additionally, you should include in the list, 
  64. popular commands such as /usr/ucb/vacation.
  65.  
  66. You should NOT include interpreter programs such as sh(1), csh(1),
  67. perl(1), uudecode(1) or the stream editor sed(1) in your list of 
  68. acceptable commands.
  69.  
  70.  
  71. You will next need to create the directory /usr/adm/sm.bin and populate 
  72. it with the programs that your site feels are allowable for sendmail
  73. to execute.   This directory is explicitly specified in the source
  74. code for smrsh, so changing this directory must be accompanied with
  75. a change in smrsh.c.
  76.  
  77.  
  78. You will have to be root to make these modifications.
  79.  
  80. After creating the /usr/adm/sm.bin directory, either copy the programs
  81. to the directory, or establish links to the allowable programs from
  82. /usr/adm/sm.bin.  Change the file permissions, so that these programs
  83. can not be modified by non-root users.  If you use links, you should
  84. ensure that the target programs are not modifiable.
  85.  
  86. To allow the popular vacation(1) program by creating a link in the 
  87. /usr/adm/sm.bin directory, you should:
  88.  
  89. host.domain# cd /usr/adm/sm.bin
  90. host.domain# ln -s /usr/ucb/vacation vacation
  91.  
  92.  
  93.  
  94.  
  95. After populating the /usr/adm/sm.bin directory, you can now configure
  96. sendmail to use the restricted shell.  Save the current sendmail.cf
  97. file prior to modifying it, as a prudent precaution.
  98.  
  99. Typically, the program mailer is defined by a single line in the 
  100. sendmail configuration file, sendmail.cf.  This file is traditionally
  101. found in the /etc, /usr/lib or /etc/mail directories, depending on 
  102. the UNIX vendor.
  103.  
  104. If you are unsure of the location of the actual sendmail configuration
  105. file, a search of the strings(1) output of the sendmail binary, will
  106. help to locate it.
  107.  
  108. In order to configure sendmail to use smrsh, you must modify the Mprog 
  109. definition in the sendmail.cf file, by replacing the /bin/sh specification 
  110. with /usr/local/etc/smrsh.
  111.  
  112. As an example:
  113.  
  114. In most Sun Microsystems' sendmail.cf files, the line is:
  115. Mprog,    P=/bin/sh,   F=lsDFMeuP,  S=10, R=20, A=sh -c $u
  116.  
  117. which should be changed to:
  118. Mprog,    P=/usr/local/etc/smrsh,   F=lsDFMeuP,  S=10, R=20, A=sh -c $u
  119.           ^^^^^^^^^^^^^^^^^^^^
  120.  
  121. A more generic line may be:
  122. Mprog,        P=/bin/sh, F=lsDFM, A=sh -c $u
  123.  
  124. and should be changed to;
  125. Mprog,        P=/usr/local/etc/smrsh, F=lsDFM, A=sh -c $u
  126.  
  127.  
  128. After modifying the Mprog definition in the sendmail.cf file, if a frozen 
  129. configuration file is being used, it is essential to create a new one.
  130. You can determine if you need a frozen configuration by discovering
  131. if a sendmail.fc file currently exists in either the /etc/, /usr/lib,
  132. or /etc/mail directories.  The specific location can be determined using
  133. a search of the strings(1) output of the sendmail binary.
  134.  
  135. In order to create a new frozen configuration, if it is required:
  136. host.domain# /usr/lib/sendmail -bz
  137.  
  138. Now re-start the sendmail process.  An example of how to do this on 
  139. a typical system follows:
  140.  
  141. host.domain# /usr/bin/ps aux | /usr/bin/grep sendmail
  142. root 130  0.0  0.0  168    0 ?  IW   Oct  2  0:10 /usr/lib/sendmail -bd -q
  143. host.domain# /bin/kill -9 130
  144. host.domain# /usr/lib/sendmail -bd -q30m
  145.